/*
 * Selling Partner API for Notifications
 * The Selling Partner API for Notifications lets you subscribe to notifications that are relevant to a selling partner's business. Using this API you can create a destination to receive notifications, subscribe to notifications, delete notification subscriptions, and more.  For more information, refer to the [Notifications Use Case Guide](https://developer-docs.amazon.com/sp-api/docs/notifications-api-v1-use-case-guide).
 *
 * OpenAPI spec version: v1
 *
 *
 * NOTE: This class is auto generated by the swagger code generator program.
 * https://github.com/swagger-api/swagger-codegen.git
 * Do not edit the class manually.
 */

package software.amazon.spapi.models.notifications.v1;

import com.google.gson.TypeAdapter;
import com.google.gson.annotations.JsonAdapter;
import com.google.gson.annotations.SerializedName;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
import java.io.IOException;

/**
 * The supported aggregation time periods. For example, if FiveMinutes is the value chosen, and 50 price updates occur
 * for an ASIN within 5 minutes, Amazon will send only two notifications; one for the first event, and then a subsequent
 * notification 5 minutes later with the final end state of the data. The 48 interim events will be dropped.
 */
@JsonAdapter(AggregationTimePeriod.Adapter.class)
public enum AggregationTimePeriod {
    @SerializedName("FiveMinutes")
    FIVEMINUTES("FiveMinutes"),
    @SerializedName("TenMinutes")
    TENMINUTES("TenMinutes");

    private String value;

    AggregationTimePeriod(String value) {
        this.value = value;
    }

    public String getValue() {
        return value;
    }

    @Override
    public String toString() {
        return String.valueOf(value);
    }

    public static AggregationTimePeriod fromValue(String input) {
        for (AggregationTimePeriod b : AggregationTimePeriod.values()) {
            if (b.value.equals(input)) {
                return b;
            }
        }
        return null;
    }

    public static class Adapter extends TypeAdapter<AggregationTimePeriod> {
        @Override
        public void write(final JsonWriter jsonWriter, final AggregationTimePeriod enumeration) throws IOException {
            jsonWriter.value(String.valueOf(enumeration.getValue()));
        }

        @Override
        public AggregationTimePeriod read(final JsonReader jsonReader) throws IOException {
            Object value = jsonReader.nextString();
            return AggregationTimePeriod.fromValue((String) (value));
        }
    }
}
